<?
$cfg_params=load_params("news");

if(file_exists("themes/".CFG_THEME."/news/ctn.news.html")) $ctn="themes/".CFG_THEME."/news/ctn.news.html";
else $ctn="modules/news/ctn.news.html";

get_ctn("news",$ctn);

if(isset($_REQUEST["news_page"])) $page=$_REQUEST["news_page"];
else $page=0;

$news_array=array();

$res=$sql->request("select * from ".CFG_MYSQL_PREFIX."news order by ts desc,id desc limit ".$page*$cfg_params["news_par_page"].",".$cfg_params["news_par_page"]);
foreach($res as $var) $news_array[]= new news($var);

$var=$sql->request_single("select count(*) as c from ".CFG_MYSQL_PREFIX."news");
$nb_pages=ceil($var->c/$cfg_params["news_par_page"]);
